package pojo;

/**
 * Created by abcdi on 2016/10/15.
 */
public class RoleLevel extends AdminRole {
    private int userlevel;
    private int scenerylevel;
    private int partylevel;
    private int notelevel;
    private int rolelevel;
    private int levellevel;
    @Override
    public void setLevel(String level){
//        System.out.println(level);
        if("0".equals(level)){
            level="000000";
        }
        super.setLevel(level);

        int[] array=new int[level.length()];
        int index=0;
        for(int i=0;i<level.length();i++){
            char c = level.charAt(i);
            array[index] = Integer.valueOf(""+c,16);
            index++;
        }
        this.setUserlevel(array[0]);
        this.setScenerylevel(array[1]);
        this.setPartylevel(array[2]);
        this.setNotelevel(array[3]);
        this.setRolelevel(array[4]);
        this.setLevellevel(array[5]);
    }

    public int getUserlevel() {
        return userlevel;
    }

    public void setUserlevel(int userlevel) {
        this.userlevel = userlevel;
    }

    public int getScenerylevel() {
        return scenerylevel;
    }

    public void setScenerylevel(int scenerylevel) {
        this.scenerylevel = scenerylevel;
    }

    public int getPartylevel() {
        return partylevel;
    }

    public void setPartylevel(int partylevel) {
        this.partylevel = partylevel;
    }

    public int getNotelevel() {
        return notelevel;
    }

    public void setNotelevel(int notelevel) {
        this.notelevel = notelevel;
    }

    public int getRolelevel() {
        return rolelevel;
    }

    public void setRolelevel(int rolelevel) {
        this.rolelevel = rolelevel;
    }

    public int getLevellevel() {
        return levellevel;
    }

    public void setLevellevel(int levellevel) {
        this.levellevel = levellevel;
    }

    public String getFormatLevel(){
//        System.out.println(Integer.toHexString(this.getUserlevel()));
//        System.out.println(Integer.toHexString(this.getScenerylevel()));
//        System.out.println(Integer.toHexString(this.getPartylevel()));
//        System.out.println(Integer.toHexString(this.getNotelevel()));
//        System.out.println(Integer.toHexString(this.getRolelevel()));
//        System.out.println(Integer.toHexString(this.getLevellevel()));

        return  Integer.toHexString(this.getUserlevel())+
                Integer.toHexString(this.getScenerylevel())+
                Integer.toHexString(this.getPartylevel())+
                Integer.toHexString(this.getNotelevel())+
                Integer.toHexString(this.getRolelevel())+
                Integer.toHexString(this.getLevellevel());
    }
}
